<template>
  <div class="page_vue">
    <div class="page_header">
      <div class="header_left">
        <div class="btn_box">
          <div class="btn_box_text">知识库</div>
        </div>
      </div>
      <div class="header_right">
        <el-input v-model="searchString" prefix-icon="Search" placeholder="搜索"></el-input>
      </div>
    </div>
    <div class="page_body">
      <div class="page_body_content">
        <div class="create_box" >
          <div class="content_header" @click="gotoPage('/newUi/ai-library/difyCreate')">
            <div class="left_icon border1">
              <el-icon>
                <Plus />
              </el-icon>
            </div>
            <div class="right_text">创建知识库</div>
          </div>
          <div class="sub_title">
            导入您自己的文本数据或通过 Webhook 实时写入数据以增强 LLM 的上下文。
          </div>
          <div class="foot_content">
            <span>链接外部知识库</span>
            <el-icon>
              <Right />
            </el-icon>
          </div>
        </div>
        <!-- 内容 -->
        <div class="content_box" @click="gotoPage('/newUi/ai-library/documents')">
          <div class="content_title">
            <div class="left_icon">
              <svg-icon icon-class="folder1" style="font-size: 20px;"></svg-icon>
            </div>
            <div class="right_title">
              <div class="title_text">1ces测试</div>
              <div class="title_text1">0文档·0千字符·0关联应用</div>
            </div>
          </div>
          <div class="content_desc">
            这你什么都没有水电费很费劲啊这你什么都没有水电费很费劲啊这你什么都没有水电费很费劲啊这你什么都没有水电费很费劲啊这你什么都没有水电费很费劲啊这你什么都没有水电费很费劲啊
          </div>
          <div class="content_foot">
            <el-dropdown>
              <div class="more_div">
                <el-icon>
                  <More />
                </el-icon>
              </div>
              <template #dropdown>
                <el-dropdown-menu>
                  <el-dropdown-item>设置</el-dropdown-item>
                  <el-dropdown-item divided>
                    <span style="color: #F56C6C;">删除</span>
                  </el-dropdown-item>
                </el-dropdown-menu>
              </template>
            </el-dropdown>
          </div>
        </div>
        <div class="content_box">1</div>
        <div class="content_box">1</div>
      </div>
    </div>
  </div>
</template>

<script setup lang='ts'>
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
// proxy?.$modal.msgSuccess('success')
const searchString = ref('');

const router = useRouter();

const gotoPage = (path: any) => {
  router.push(path)
}




</script>
<style scoped lang='scss'>
@mixin textOverflow($clamp) {
  text-overflow: ellipsis;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: $clamp; //元素几行显示
  -webkit-box-orient: vertical;
}

.page_vue {
  width: 100%;
  height: calc(100vh - 50px);
  background-color: #f2f4f7;
}

.page_header {
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn_box_text {
  font-size: 13px;
  padding: 7px 12px;
  border-radius: 8px;
  background-color: #ffffff;
  color: #155eef;
  box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, .05);
  border: 1px solid rgba(234 236 240);
}

.header_right {
  :deep(.el-input__wrapper) {
    border-radius: 8px;
    background-color: #eaecf0;
    transition: all .3s;
    font-size: 13px;
    color: #475467;

  }

  :deep(.el-input__wrapper.is-focus) {
    box-shadow: 0 0 0 1px #155eef !important;
    background-color: #ffffff !important;
  }

  :deep(.el-input__inner::placeholder) {
    color: #475467;
    font-size: 13px;
  }


}

.page_body {
  padding: 0 12px 12px;

  .page_body_content {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
  }

  .create_box {
    border-radius: 12px;
    border: 1px solid #10182814;

    .content_header {
      padding: 16px;
      display: flex;
      align-items: center;
      cursor: pointer;

      .left_icon {
        width: 40px;
        height: 40px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: #f9fafb;
      }

      .border1 {
        border: 1px dashed #10182814;
      }

      .right_text {
        color: #354052;
        font-size: 14px;
        font-weight: bold;
        margin-left: 10px;
      }

      &:hover {

        .right_text,
        .left_icon {
          color: #155aef;
        }

        .border1 {
          border: 1px dashed #ffffff;
        }
      }
    }

    .sub_title {
      padding: 0 16px;
      margin-bottom: 16px;
      height: 35px;
      font-size: 12px;
      color: #676f83;
    }

    .foot_content {
      border-top: 1px solid #1018280a;

      padding: 16px;
      color: #636f63;
      font-size: 12px;
      display: flex;
      align-items: center;
      cursor: pointer;

      span {
        margin-right: 5px;
      }

      &:hover {
        color: #155aef;
      }
    }
  }

  .content_box {
    border-radius: 12px;
    border: 1px solid #1018280a;
    box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, .06), 0px 1px 3px 0px rgba(16, 24, 40, .1);
    background-color: #ffffff;
    padding: 16px;
    cursor: pointer;
    transition: all .3s;

    .content_title {
      display: flex;
    }

    .left_icon {
      width: 40px;
      height: 40px;
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      background-color: #f5f8ff;
      border: 1px solid rgb(224 234 255);
    }

    .right_title {
      margin-left: 10px;

      .title_text {
        font-size: 14px;
        font-weight: bold;
        color: #1d2939;
      }

      .title_text1 {
        color: #667085;
        font-size: 12px;
        margin-top: 5px;
      }
    }

    .content_desc {
      height: 35px;
      font-size: 12px;
      color: #667085;
      margin-top: 10px;
      margin-bottom: 10px;
      @include textOverflow(2);
    }

    .content_foot {
      width: 100%;
      padding: 6px;
      display: flex;
      justify-content: flex-end;
      visibility: hidden;

      .more_div {
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        cursor: pointer;
        color: #475467;

        &:hover {
          background-color: #f2f2f2;
        }
      }
    }
  }

  .content_box:hover {
    box-shadow: 0px 4px 6px -2px rgba(16, 24, 40, .03), 0px 12px 16px -4px rgba(16, 24, 40, .08);

    .content_foot {
      visibility: visible;
    }
  }
}
</style>